package com.threader.bo;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Random;


public class Passport {
	private final String[] sexCaption = {"Mail", "Femail"};
	public final static String[] firstNamesM = {"Yura", "Dima", "Joseph", "Sergey", "Max", "Sasha", "Sam", "Jim", "John", "Victor"};
	public final static String[] firstNamesF = {"Kat", "Lena", "Marina", "Olga", "Tania", "Liliya"};
	
	public static final int MAIL = 0;
	public static final int FEMAIL = 1;
	
	private String number = "nonumber";
	private String firstName = "noname";
	private String lastName = "noname";
	private Integer sex;

	public long birthDay; 
		//35*365*24*60*60*1000;
	
	public Passport(String firstName, String lastName, Integer sex, GregorianCalendar age) {
		setBithday(age.getTimeInMillis());
		this.setFirstName(firstName);
//				firstNamesM[new Integer(firstName.substring(firstName.length()-1, firstName.length()))]);
		this.setLastName(lastName);
		this.setNumber("KK"+new Random().nextInt(999999));
		this.setSex(sex);
//				new Integer(String.valueOf(sex).substring(0, 1)));
	}

	public String toString() {
		return getFirstName() + " " + getLastName() + ", " + getSex() + ", "
				+ getNumber();
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public String getLastName() {
		return lastName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getFirstName() {
		return firstName;
	}

	public void setNumber(String number) {
		this.number = number;
	}

	public String getNumber() {
		return number;
	}

	public void setSex(Integer sex) {
		this.sex = sex;
	}

	public String getSex() {
		return this.sexCaption[this.sex];
	}

	public void setBithday(long birthDay) {
		this.birthDay = birthDay;
	}

	public String getBithDay() {
		return new SimpleDateFormat("dd").format(new Date(this.birthDay))+" "+
			new SimpleDateFormat("MMM").format(new Date(this.birthDay))+" "+
			new SimpleDateFormat("yyyy").format(new Date(this.birthDay));
	}

}
